﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common.Model;
using Common.ServiceLogic;
using System.Data.Objects.DataClasses;

namespace Common.UI.EM.Views.Interfaces
{
    public partial interface IEntityPresentationModel<S, E, C, EV>
        where S : IGenericEntityManagerServiceLogic<E, C, EV>, new()
        where E : IObjectWithChangeTracker
        where C : CriteriaEntity
        where EV : ViewEntity
    {

        #region Filter
        IFilterView FilterView
        {
            get;
            set;
        }

        void LoadCriteria(C CriteriaEntity);

        event SearchCalledEventHandler SearchCalled;
        #endregion

        #region List
        IListView ListView
        {
            get;
            set;
        }

        void LoadList(C CriteriaEntity);

        void AddColumnDefinition(String columnName, String header);

        event ViewCalledEventHandler ViewCalled;
        event DeleteCalledEventHandler DeleteCalled;
        event ModifyCalledEventHandler ModifyCalled;
        event AddCalledEventHandler AddCalled;


        Boolean AllowAdd
        {
            get;
            set;
        }
        Boolean AllowDelete
        {
            get;
            set;
        }
        Boolean AllowModify
        {
            get;
            set;
        }
        Boolean AllowView
        {
            get;
            set;
        }

        #endregion

        #region Detail
        DetailMode Mode
        {
            get;
            set;
        }

        IDetailView DetailView
        {
            get;
            set;
        }

        void LoadEntity(Guid id);

        void LoadEntity(EV ev);

        void LoadEntity(E entity);

        event CancelCalledEventHandler CancelCalled;
        event SaveCalledEventHandler SaveCalled;

        void ShowDetail(DetailMode detailMode, ViewEntity viewEntity);
        #endregion

    }

    public enum DetailMode
    {
        View = 0,
        Add = 1,
        Modify = 2,
        Delete = 3
    }
}